<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBatchInventoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('batch_inventories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('customer_id')->comment('客户ID');
            $table->unsignedBigInteger('product_id')->comment('产品ID');
            $table->unsignedBigInteger('location_id')->comment('货架号');
            $table->unsignedBigInteger('warehousing_id')->comment('入库单号');
            $table->unsignedTinyInteger('attribute')->comment('属性: 0 良品 1 不良品');
            $table->string('barcode', 64)->comment('产品条码');
            $table->integer('quantity')->comment('数量');
            $table->tinyInteger('expire')->default(0)->comment('是否到期 0 没到期 1 到期');
            $table->date('expiry')->nullable()->comment('有效期');
            $table->string('batch', 50)->comment('批次号');
            $table->date('produce')->nullable()->comment('生产日期');
            $table->string('remark')->nullable()->comment('备注');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('batch_inventories');
    }
}
